const express = require("express");
const path = require("path");
const app = express();
const cors = require("cors");
app.use(cors());
app.use(express.json())//解析数据的新 body 对象在中间件（即 req.body）
app.use(express.urlencoded({ extended: true }))

//配置静态服务,注意绝对路径
app.use(express.static(path.resolve(__dirname,"public")));

//消息界面接口
const message_router = require("./router/message");
app.use("/api", message_router);
 
app.listen(8080, () => {
  console.log("Server is running on port 8080");
});
